# Generated by Django 5.0.2 on 2024-03-01 21:34

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Status",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="когда создан"),
                ),
                ("title", models.CharField(max_length=50, verbose_name="Статус задачи")),
                (
                    "created_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="created_statuses",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="кем создан",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Task",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="когда создана"),
                ),
                ("description", models.TextField(verbose_name="описание")),
                (
                    "created_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="created_tasks",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="кем создана",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ShotTask",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "shot",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="task_statuses",
                        to="core.shot",
                        verbose_name="шот",
                    ),
                ),
                (
                    "status",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="shot_tasks",
                        to="core.status",
                        verbose_name="статус",
                    ),
                ),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="used_in_shots",
                        to="core.task",
                        verbose_name="задача",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="shot",
            name="task",
            field=models.ManyToManyField(
                related_name="shots",
                through="core.ShotTask",
                to="core.task",
                verbose_name="задача на шот",
            ),
        ),
    ]
